package com.ciwong.epaper.modules.wordlist.dao;

import com.ciwong.mobilelib.i.BaseCallBack;

/**
 * 我 相关业务Dao
 *
 * @author bin
 * @version ciwong v.1.0 2015/7/23 20:08
 * @since ciwong v.1.0
 */
public class WorkBookDao {
    private static WorkBookDao instance;

    private WorkBookDao() {

    }

    /**
     * 获取唯一实例
     *
     * @return 唯一实例
     */
    public static WorkBookDao getInstance() {
        if (instance == null) {
            syncInit();
        }
        return instance;
    }

    /**
     * 实例化对象
     */
    private static synchronized void syncInit() {
        if (instance == null) {
            instance = new WorkBookDao();
        }
    }

    /**
     * 获取练习册列表
     */
    public void getWorkBookListFromNet(int brandId, long userId, int page, int pageSize, String scoreRange, final BaseCallBack callBack) {
         WorkBookRequest.getWorkBookListFromNet(brandId,userId,page,pageSize, scoreRange,callBack);
    }

    public void submitWordReadWork(String json, final BaseCallBack callBack) {

        WorkBookRequest.submitWordReadWork(json, new BaseCallBack() {


            @Override
            public void success(Object data) {
                callBack.success(data);

            }

            @Override
            public void failed(int errorCode, Object data) {

                String msg = String.valueOf(data);

                callBack.failed(errorCode, msg);
            }

            @Override
            public void failed(Object data) {
                callBack.failed(data);
            }
        });
    }


}
